package com.dxy.dataManage.urils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author dxy
 * @version 1.0
 */
public class FileUtils {
    //public static String[]  getNameArrays(String urls){
    //    //String[] names = {"aaa.png"};
    //    return null;
    //}
    //public static String[]  getPathArrays(String urls){
    //    String[] paths = {"d:\\temp_upload\\2022年10月31日 19点20分36秒\\aaa.png"};
    //    return paths;
    //}
    public static List<String[]> getNamesAndPathsList(String urls){
        List<String[]> urlInfoList = new ArrayList();
        String[] names = new String[1];
        String[] paths = new String[1];

        if (urls.contains(";")){
            names = new String[urls.split(";").length];
            paths = urls.split(";");
            for (int i = 0; i < paths.length; i++) {
                int start = paths[i].lastIndexOf("\\");
                String name = paths[i].substring(start + 1);
                names[i] = name;
            }
        }else {
            paths[0] = urls;
            int start = urls.lastIndexOf("\\");
            String name = urls.substring(start + 1);
            names[0] = name;
        }
        urlInfoList.add(names);
        urlInfoList.add(paths);
        return  urlInfoList;
    }
}
